home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / wgdb-42.lha / wgdb-4.2 / bfd / elf.c < prev    next >
C/C++ Source or Header  |  1992-09-11  |  19KB  |  634 lines

  1. /* ELF support for BFD.
  2.    Copyright (C) 1991 Free Software Foundation, Inc.
  3.  
  4.    Written by Fred Fish @ Cygnus Support, from information published
  5.    in "UNIX System V Release 4, Programmers Guide: ANSI C and
  6.    Programming Support Tools".
  7.  
  8. This file is part of BFD, the Binary File Descriptor library.
  9.  
  10. This program is free software; you can redistribute it and/or modify
  11. it under the terms of the GNU General Public License as published by
  12. the Free Software Foundation; either version 2 of the License, or
  13. (at your option) any later version.
  14.  
  15. This program is distributed in the hope that it will be useful,
  16. but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18. GNU General Public License for more details.
  19.  
  20. You should have received a copy of the GNU General Public License
  21. along with this program; if not, write to the Free Software
  22. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  23.  
  24.  
  25.     /****************************************
  26.  
  27.               WARNING
  28.  
  29.     This is only a partial ELF implementation,
  30.     incorporating only those parts that are
  31.     required to get gdb up and running.  It is
  32.     expected that it will be expanded to a full
  33.     ELF implementation at some future date.
  34.  
  35.     Unimplemented stubs call abort() to ensure
  36.     that they get proper attention if they are
  37.     ever called.  The stubs are here since
  38.     this version was hacked from the COFF
  39.     version, and thus they will probably
  40.     go away or get expanded appropriately in a
  41.     future version.
  42.  
  43.     fnf@cygnus.com
  44.  
  45.     *****************************************/
  46.  
  47.  
  48. /* Problems and other issues to resolve.
  49.  
  50.    (1)    BFD expects there to be some fixed number of "sections" in
  51.         the object file.  I.E. there is a "section_count" variable in the
  52.     bfd structure which contains the number of sections.  However, ELF
  53.     supports multiple "views" of a file.  In particular, with current
  54.     implementations, executable files typically have two tables, a
  55.     program header table and a section header table, both of which
  56.     partition the executable.
  57.  
  58.     In ELF-speak, the "linking view" of the file uses the section header
  59.     table to access "sections" within the file, and the "execution view"
  60.     uses the program header table to access "segments" within the file.
  61.     "Segments" typically may contain all the data from one or more
  62.     "sections".
  63.  
  64.     Note that the section header table is optional in ELF executables,
  65.     but it is this information that is most useful to gdb.  If the
  66.     section header table is missing, then gdb should probably try
  67.     to make do with the program header table.  (FIXME)
  68.  
  69. */
  70.  
  71. #include "bfd.h"
  72. #include "sysdep.h"
  73. #include "libbfd.h"
  74. #include "obstack.h"
  75. #include "elf-common.h"
  76. #include "elf-internal.h"
  77. #include "elf-external.h"
  78.  
  79. /* Forward data declarations */
  80. extern bfd_target elf_little_vec, elf_big_vec;
  81.  
  82. /* Translate an ELF header in external format into an ELF header in internal
  83.    format. */
  84.  
  85. static void
  86. DEFUN(bfd_swap_ehdr_in,(abfd, src, dst),
  87.       bfd               *abfd AND
  88.       Elf_External_Ehdr *src AND
  89.       Elf_Internal_Ehdr *dst)
  90. {
  91.   bcopy (src -> e_ident, dst -> e_ident, EI_NIDENT);
  92.   dst -> e_type = bfd_h_get_16 (abfd, (bfd_byte *) src -> e_type);
  93.   dst -> e_machine = bfd_h_get_16 (abfd, (bfd_byte *) src -> e_machine);
  94.   dst -> e_version = bfd_h_get_32 (abfd, (bfd_byte *) src -> e_version);
  95.   dst -> e_entry = bfd_h_get_32 (abfd, (bfd_byte *) src -> e_entry);
  96.   dst -> e_phoff = bfd_h_get_32 (abfd, (bfd_byte *) src -> e_phoff);
  97.   dst -> e_shoff = bfd_h_get_32 (abfd, (bfd_byte *) src -> e_shoff);
  98.   dst -> e_flags = bfd_h_get_32 (abfd, (bfd_byte *) src -> e_flags);
  99.   dst -> e_ehsize = bfd_h_get_16 (abfd, (bfd_byte *) src -> e_ehsize);
  100.   dst -> e_phentsize = bfd_h_get_16 (abfd, (bfd_byte *) src -> e_phentsize);
  101.   dst -> e_phnum = bfd_h_get_16 (abfd, (bfd_byte *) src -> e_phnum);
  102.   dst -> e_shentsize = bfd_h_get_16 (abfd, (bfd_byte *) src -> e_shentsize);
  103.   dst -> e_shnum = bfd_h_get_16 (abfd, (bfd_byte *) src -> e_shnum);
  104.   dst -> e_shstrndx = bfd_h_get_16 (abfd, (bfd_byte *) src -> e_shstrndx);
  105. }
  106.  
  107.  
  108. /* Translate an ELF section header table entry in external format into an
  109.    ELF section header table entry in internal format. */
  110.  
  111. static void
  112. DEFUN(bfd_swap_shdr_in,(abfd, src, dst),
  113.       bfd               *abfd AND
  114.       Elf_External_Shdr *src AND
  115.       Elf_Internal_Shdr *dst)
  116. {
  117.   dst -> sh_name = bfd_h_get_32 (abfd, (bfd_byte *) src -> sh_name);
  118.   dst -> sh_type = bfd_h_get_32 (abfd, (bfd_byte *) src -> sh_type);
  119.   dst -> sh_flags = bfd_h_get_32 (abfd, (bfd_byte *) src -> sh_flags);
  120.   dst -> sh_addr = bfd_h_get_32 (abfd, (bfd_byte *) src -> sh_addr);
  121.   dst -> sh_offset = bfd_h_get_32 (abfd, (bfd_byte *) src -> sh_offset);
  122.   dst -> sh_size = bfd_h_get_32 (abfd, (bfd_byte *) src -> sh_size);
  123.   dst -> sh_link = bfd_h_get_32 (abfd, (bfd_byte *) src -> sh_link);
  124.   dst -> sh_info = bfd_h_get_32 (abfd, (bfd_byte *) src -> sh_info);
  125.   dst -> sh_addralign = bfd_h_get_32 (abfd, (bfd_byte *) src -> sh_addralign);
  126.   dst -> sh_entsize = bfd_h_get_32 (abfd, (bfd_byte *) src -> sh_entsize);
  127. }
  128.  
  129.  
  130. /* Create a new bfd section from an ELF section header. */
  131.  
  132. static boolean
  133. DEFUN(bfd_section_from_shdr, (abfd, hdr, shstrtab),
  134.       bfd               *abfd AND
  135.       Elf_Internal_Shdr *hdr AND
  136.       char        *shstrtab)
  137. {
  138.   asection *newsect;
  139.   char *name;
  140.  
  141.   name = hdr -> sh_name ? shstrtab + hdr -> sh_name : "unnamed";
  142.   newsect = bfd_make_section (abfd, name);
  143.   newsect -> vma = hdr -> sh_addr;
  144.   newsect -> size = hdr -> sh_size;
  145.   if (!(hdr -> sh_type == SHT_NOBITS))
  146.     {
  147.       newsect -> filepos = hdr -> sh_offset;
  148.       newsect -> flags |= SEC_HAS_CONTENTS;
  149.     }
  150.   if (hdr -> sh_flags & SHF_ALLOC)
  151.     {
  152.       newsect -> flags |= SEC_ALLOC;
  153.       if (hdr -> sh_type != SHT_NOBITS)
  154.     {
  155.       newsect -> flags |= SEC_LOAD;
  156.     }
  157.     }
  158.   if (!(hdr -> sh_flags & SHF_WRITE))
  159.     {
  160.       newsect -> flags |= SEC_READONLY;
  161.     }
  162.   if (hdr -> sh_flags & SHF_EXECINSTR)
  163.     {
  164.       newsect -> flags |= SEC_CODE;    /* FIXME: may only contain SOME code */
  165.     }
  166.   if (hdr -> sh_type == SHT_SYMTAB)
  167.     {
  168.       abfd -> flags |= HAS_SYMS;
  169.     }
  170.  
  171.   return (true);
  172. }
  173.  
  174. /* Begin processing a given object.
  175.  
  176.    First we validate the file by reading in the ELF header and checking
  177.    the magic number.
  178.  
  179.    */
  180.  
  181. static bfd_target *
  182. DEFUN (elf_object_p, (abfd), bfd *abfd)
  183. {
  184.   Elf_External_Ehdr x_ehdr;    /* Elf file header, external form */
  185.   Elf_Internal_Ehdr i_ehdr;    /* Elf file header, internal form */
  186.   Elf_External_Shdr *x_shdr;    /* Section header table, external form */
  187.   Elf_Internal_Shdr *i_shdr;    /* Section header table, internal form */
  188.   int shindex;
  189.   char *shstrtab;        /* Internal copy of section header stringtab */
  190.   int shstrtabsize;        /* Size of section header string table */
  191.   
  192.   /* Read in the ELF header in external format.  */
  193.  
  194.   if (bfd_read ((PTR) &x_ehdr, sizeof (x_ehdr), 1, abfd) != sizeof (x_ehdr))
  195.     {
  196.       bfd_error = system_call_error;
  197.       return (NULL);
  198.     }
  199.  
  200.   /* Now check to see if we have a valid ELF file, and one that BFD can
  201.      make use of.  The magic number must match, the address size ('class')
  202.      and byte-swapping must match our XVEC entry, and it must have a
  203.      section header table (FIXME: See comments re sections at top of this
  204.      file). */
  205.  
  206.   if (x_ehdr.e_ident[EI_MAG0] != ELFMAG0 ||
  207.       x_ehdr.e_ident[EI_MAG1] != ELFMAG1 ||
  208.       x_ehdr.e_ident[EI_MAG2] != ELFMAG2 ||
  209.       x_ehdr.e_ident[EI_MAG3] != ELFMAG3)
  210.     {
  211. wrong:
  212.       bfd_error = wrong_format;
  213.       return (NULL);
  214.     }
  215.  
  216.   /* FIXME, Check EI_VERSION here !  */
  217.  
  218.   switch (x_ehdr.e_ident[EI_CLASS]) {
  219.   case ELFCLASSNONE:            /* address size not specified */
  220.     goto wrong;            /* No support if can't tell address size */
  221.   case ELFCLASS32:            /* 32-bit addresses */
  222.     break;
  223.   case ELFCLASS64:            /* 64-bit addresses */
  224.     goto wrong;            /* FIXME: 64 bits not yet supported */
  225.   default:
  226.     goto wrong;            /* No support if unknown address class */
  227.   }
  228.  
  229.   /* Switch xvec to match the specified byte order.  */
  230.   switch (x_ehdr.e_ident[EI_DATA]) {
  231.   case ELFDATA2MSB:            /* Big-endian */ 
  232.     abfd->xvec = &elf_big_vec;
  233.     break;
  234.   case ELFDATA2LSB:            /* Little-endian */
  235.     abfd->xvec = &elf_little_vec;
  236.   case ELFDATANONE:            /* No data encoding specified */
  237.   default:                /* Unknown data encoding specified */
  238.     goto wrong;
  239.   }
  240.   
  241.   /* Now that we know the byte order, swap in the rest of the header */
  242.   bfd_swap_ehdr_in (abfd, &x_ehdr, &i_ehdr);
  243.   if (x_ehdr.e_shoff == 0)
  244.     goto wrong;
  245.  
  246.   if (i_ehdr.e_type == ET_EXEC || i_ehdr.e_type == ET_DYN)
  247.     {
  248.       abfd -> flags |= EXEC_P;
  249.     }
  250.  
  251.   /* Allocate space for copies of the section header table in external
  252.      and internal form, seek to the section header table in the file,
  253.      read it in, and convert it to internal form.  As a simple sanity
  254.      check, verify that the what BFD thinks is the size of each section
  255.      header table entry actually matches the size recorded in the file. */
  256.  
  257.   if (i_ehdr.e_shentsize != sizeof (*x_shdr))
  258.     goto wrong;
  259.   if ((x_shdr = (Elf_External_Shdr *)
  260.     bfd_alloc (abfd, sizeof (*x_shdr) * i_ehdr.e_shnum)) == NULL)
  261.     {
  262.       bfd_error = no_memory;
  263.       return (NULL);
  264.     }
  265.   if ((i_shdr = (Elf_Internal_Shdr *)
  266.     bfd_alloc (abfd, sizeof (*i_shdr) * i_ehdr.e_shnum)) == NULL)
  267.     {
  268.       bfd_error = no_memory;
  269.       return (NULL);
  270.     }
  271.   if (bfd_seek (abfd, i_ehdr.e_shoff, SEEK_SET) == -1)
  272.     {
  273.       bfd_error = system_call_error;
  274.       return (NULL);
  275.     }
  276.   for (shindex = 0; shindex < i_ehdr.e_shnum; shindex++)
  277.     {
  278.       if (bfd_read ((PTR) (x_shdr + shindex), sizeof (*x_shdr), 1, abfd)
  279.       != sizeof (*x_shdr))
  280.     {
  281.       bfd_error = system_call_error;
  282.       return (NULL);
  283.     }
  284.       bfd_swap_shdr_in (abfd, x_shdr + shindex, i_shdr + shindex);
  285.     }
  286.  
  287.   /* Read in the string table containing the names of the sections.  We
  288.      will need the base pointer to this table later. */
  289.  
  290.   shstrtabsize = i_shdr[i_ehdr.e_shstrndx].sh_size;
  291.   if ((shstrtab = bfd_alloc (abfd, shstrtabsize)) == NULL)
  292.     {
  293.       bfd_error = no_memory;
  294.       return (NULL);
  295.     }
  296.   if (bfd_seek (abfd, i_shdr[i_ehdr.e_shstrndx].sh_offset, SEEK_SET) == -1)
  297.     {
  298.       bfd_error = system_call_error;
  299.       return (NULL);
  300.     }
  301.   if (bfd_read ((PTR) shstrtab, shstrtabsize, 1, abfd) != shstrtabsize)
  302.     {
  303.       bfd_error = system_call_error;
  304.       return (NULL);
  305.     }
  306.   
  307.   /* Once all of the section headers have been read and converted, we
  308.      can start processing them. */
  309.  
  310.   for (shindex = 0; shindex < i_ehdr.e_shnum; shindex++)
  311.     {
  312.       bfd_section_from_shdr (abfd, i_shdr + shindex, shstrtab);
  313.     }
  314.  
  315.   return (abfd->xvec);
  316. }
  317.  
  318. static boolean
  319. DEFUN (elf_mkobject, (abfd), bfd *abfd)
  320. {
  321.   fprintf (stderr, "elf_mkobject unimplemented\n");
  322.   fflush (stderr);
  323.   abort ();
  324.   return (false);
  325. }
  326.  
  327. static boolean
  328. DEFUN (elf_write_object_contents, (abfd), bfd *abfd)
  329. {
  330.   fprintf (stderr, "elf_write_object_contents unimplemented\n");
  331.   fflush (stderr);
  332.   abort ();
  333.   return (false);
  334. }
  335.  
  336. static unsigned int
  337. elf_get_symtab_upper_bound(abfd)
  338. bfd *abfd;
  339. {
  340.   fprintf (stderr, "elf_get_symtab_upper_bound unimplemented\n");
  341.   fflush (stderr);
  342.   abort ();
  343.   return (0);
  344. }
  345.  
  346. static unsigned int
  347. elf_get_reloc_upper_bound (abfd, asect)
  348. bfd            *abfd;
  349. sec_ptr         asect;
  350. {
  351.   fprintf (stderr, "elf_get_reloc_upper_bound unimplemented\n");
  352.   fflush (stderr);
  353.   abort ();
  354.   return (0);
  355. }
  356.  
  357. static unsigned int
  358. elf_canonicalize_reloc (abfd, section, relptr, symbols)
  359. bfd            *abfd;
  360. sec_ptr         section;
  361. arelent       **relptr;
  362. asymbol       **symbols;
  363. {
  364.   fprintf (stderr, "elf_canonicalize_reloc unimplemented\n");
  365.   fflush (stderr);
  366.   abort ();
  367.   return (0);
  368. }
  369.  
  370. static unsigned int
  371. elf_get_symtab (abfd, alocation)
  372. bfd            *abfd;
  373. asymbol       **alocation;
  374. {
  375.   fprintf (stderr, "elf_get_symtab unimplemented\n");
  376.   fflush (stderr);
  377.   abort ();
  378.   return (0);
  379. }
  380.  
  381. static asymbol *
  382. elf_make_empty_symbol(abfd)
  383. bfd            *abfd;
  384. {
  385.   fprintf (stderr, "elf_make_empty_symbol unimplemented\n");
  386.   fflush (stderr);
  387.   abort ();
  388.   return (NULL);
  389. }
  390.  
  391. static void 
  392. DEFUN (elf_print_symbol,(ignore_abfd, filep, symbol, how),
  393.       bfd            *ignore_abfd AND
  394.       PTR           filep AND
  395.       asymbol        *symbol AND
  396.       bfd_print_symbol_type how)
  397. {
  398.   fprintf (stderr, "elf_print_symbol unimplemented\n");
  399.   fflush (stderr);
  400.   abort ();
  401. }
  402.  
  403. static alent *
  404. DEFUN (elf_get_lineno,(ignore_abfd, symbol),
  405.       bfd            *ignore_abfd AND
  406.       asymbol        *symbol)
  407. {
  408.   fprintf (stderr, "elf_get_lineno unimplemented\n");
  409.   fflush (stderr);
  410.   abort ();
  411.   return (NULL);
  412. }
  413.  
  414. static boolean
  415. DEFUN (elf_set_arch_mach,(abfd, arch, machine),
  416.       bfd            *abfd AND
  417.       enum bfd_architecture arch AND
  418.       unsigned long   machine)
  419. {
  420.   fprintf (stderr, "elf_set_arch_mach unimplemented\n");
  421.   fflush (stderr);
  422.   /* Allow any architecture to be supported by the elf backend */
  423.   return  bfd_default_set_arch_mach(abfd, arch, machine);
  424. }
  425.  
  426. static boolean
  427. DEFUN (elf_find_nearest_line,(abfd,
  428.                   section,
  429.                   symbols,
  430.                   offset,
  431.                   filename_ptr,
  432.                   functionname_ptr,
  433.                   line_ptr),
  434.       bfd            *abfd AND
  435.       asection       *section AND
  436.       asymbol       **symbols AND
  437.       bfd_vma         offset AND
  438.       CONST char      **filename_ptr AND
  439.       CONST char       **functionname_ptr AND
  440.       unsigned int   *line_ptr)
  441. {
  442.   fprintf (stderr, "elf_find_nearest_line unimplemented\n");
  443.   fflush (stderr);
  444.   abort ();
  445.   return (false);
  446. }
  447.  
  448. static int 
  449. DEFUN (elf_sizeof_headers, (abfd, reloc),
  450.       bfd *abfd AND
  451.       boolean reloc)
  452. {
  453.   fprintf (stderr, "elf_sizeof_headers unimplemented\n");
  454.   fflush (stderr);
  455.   abort ();
  456.   return (0);
  457. }
  458.  
  459. /* This structure contains everything that BFD knows about a target.
  460.    It includes things like its byte order, name, what routines to call
  461.    to do various operations, etc.  Every BFD points to a target structure
  462.    with its "xvec" member.
  463.  
  464.    There are two such structures here:  one for big-endian machines and
  465.    one for little-endian machines.   */
  466.  
  467. #define elf_core_file_failing_command    _bfd_dummy_core_file_failing_command
  468. #define elf_core_file_failing_signal    _bfd_dummy_core_file_failing_signal
  469. #define elf_core_file_matches_executable_p    _bfd_dummy_core_file_matches_executable_p
  470.  
  471. /* Archives are generic or unimplemented.  */
  472. #define elf_slurp_armap            bfd_false
  473. #define elf_slurp_extended_name_table    _bfd_slurp_extended_name_table
  474. #define elf_truncate_arname        bfd_dont_truncate_arname
  475. #define elf_openr_next_archived_file    bfd_generic_openr_next_archived_file
  476. #define elf_generic_stat_arch_elt    bfd_generic_stat_arch_elt
  477. #define    elf_write_armap            (PROTO (boolean, (*),        \
  478.      (bfd *arch, unsigned int elength, struct orl *map, int orl_count,    \
  479.       int stridx))) bfd_false
  480.  
  481. /* Ordinary section reading and writing */
  482. #define elf_new_section_hook        _bfd_dummy_new_section_hook
  483. #define    elf_get_section_contents    bfd_generic_get_section_contents
  484. #define    elf_set_section_contents    bfd_generic_set_section_contents
  485. #define    elf_close_and_cleanup        bfd_generic_close_and_cleanup
  486.  
  487. #define elf_bfd_debug_info_start    bfd_void
  488. #define elf_bfd_debug_info_end        bfd_void
  489. #define elf_bfd_debug_info_accumulate    (PROTO(void,(*),(bfd*, struct sec *))) bfd_void
  490.  
  491. bfd_target elf_big_vec =
  492. {
  493.   /* name: identify kind of target */
  494.   "elf-big",
  495.  
  496.   /* flavour: general indication about file */
  497.   bfd_target_elf_flavour,
  498.  
  499.   /* byteorder_big_p: data is big endian */
  500.   true,
  501.  
  502.   /* header_byteorder_big_p: header is also big endian */
  503.   true,
  504.  
  505.   /* object_flags: mask of all file flags */
  506.   (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
  507.    DYNAMIC | WP_TEXT),
  508.   
  509.   /* section_flags: mask of all section flags */
  510.   (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
  511.    SEC_DATA), 
  512.  
  513.   /* ar_pad_char: pad character for filenames within an archive header
  514.      FIXME:  this really has nothing to do with ELF, this is a characteristic
  515.      of the archiver and/or os and should be independently tunable */
  516.   '/',
  517.  
  518.   /* ar_max_namelen: maximum number of characters in an archive header
  519.      FIXME:  this really has nothing to do with ELF, this is a characteristic
  520.      of the archiver and should be independently tunable.  This value is
  521.      a WAG (wild a** guess) */
  522.   15,
  523.  
  524.   /* align_power_min: minimum alignment restriction for any section
  525.      FIXME:  this value may be target machine dependent */
  526.   3,
  527.  
  528.   /* Routines to byte-swap various sized integers from the data sections */
  529.   _do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16,
  530.  
  531.   /* Routines to byte-swap various sized integers from the file headers */
  532.   _do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16,
  533.  
  534.   /* bfd_check_format: check the format of a file being read */
  535.   { _bfd_dummy_target,
  536.     elf_object_p,
  537.     bfd_generic_archive_p,
  538.     _bfd_dummy_target
  539.   },
  540.  
  541.   /* bfd_set_format: set the format of a file being written */
  542.   { bfd_false,
  543.     elf_mkobject,
  544.     _bfd_generic_mkarchive,
  545.     bfd_false
  546.   },
  547.  
  548.   /* bfd_write_contents: write cached information into a file being written */
  549.   { bfd_false,
  550.     elf_write_object_contents,
  551.     _bfd_write_archive_contents,
  552.     bfd_false
  553.   },
  554.  
  555.   /* Initialize a jump table with the standard macro.  All names start
  556.      with "elf" */
  557.   JUMP_TABLE(elf),
  558.  
  559.   /* SWAP_TABLE */
  560.   NULL, NULL, NULL
  561. };
  562.  
  563. bfd_target elf_little_vec =
  564. {
  565.   /* name: identify kind of target */
  566.   "elf-little",
  567.  
  568.   /* flavour: general indication about file */
  569.   bfd_target_elf_flavour,
  570.  
  571.   /* byteorder_big_p: data is big endian */
  572.   false,        /* Nope -- this one's little endian */
  573.  
  574.   /* header_byteorder_big_p: header is also big endian */
  575.   false,        /* Nope -- this one's little endian */
  576.  
  577.   /* object_flags: mask of all file flags */
  578.   (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
  579.    DYNAMIC | WP_TEXT),
  580.   
  581.   /* section_flags: mask of all section flags */
  582.   (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
  583.    SEC_DATA), 
  584.  
  585.   /* ar_pad_char: pad character for filenames within an archive header
  586.      FIXME:  this really has nothing to do with ELF, this is a characteristic
  587.      of the archiver and/or os and should be independently tunable */
  588.   '/',
  589.  
  590.   /* ar_max_namelen: maximum number of characters in an archive header
  591.      FIXME:  this really has nothing to do with ELF, this is a characteristic
  592.      of the archiver and should be independently tunable.  This value is
  593.      a WAG (wild a** guess) */
  594.   15,
  595.  
  596.   /* align_power_min: minimum alignment restriction for any section
  597.      FIXME:  this value may be target machine dependent */
  598.   3,
  599.  
  600.   /* Routines to byte-swap various sized integers from the data sections */
  601.   _do_getl64, _do_putl64, _do_getl32, _do_putl32, _do_getl16, _do_putl16,
  602.  
  603.   /* Routines to byte-swap various sized integers from the file headers */
  604.   _do_getl64, _do_putl64, _do_getl32, _do_putl32, _do_getl16, _do_putl16,
  605.  
  606.   /* bfd_check_format: check the format of a file being read */
  607.   { _bfd_dummy_target,
  608.     elf_object_p,
  609.     bfd_generic_archive_p,
  610.     _bfd_dummy_target
  611.   },
  612.  
  613.   /* bfd_set_format: set the format of a file being written */
  614.   { bfd_false,
  615.     elf_mkobject,
  616.     _bfd_generic_mkarchive,
  617.     bfd_false
  618.   },
  619.  
  620.   /* bfd_write_contents: write cached information into a file being written */
  621.   { bfd_false,
  622.     elf_write_object_contents,
  623.     _bfd_write_archive_contents,
  624.     bfd_false
  625.   },
  626.  
  627.   /* Initialize a jump table with the standard macro.  All names start
  628.      with "elf" */
  629.   JUMP_TABLE(elf),
  630.  
  631.   /* SWAP_TABLE */
  632.   NULL, NULL, NULL
  633. };
  634.